package com.clear.honghefinance.biz.modules.dictionary.domain.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serializable;
import java.util.Date;

import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 数据字典
 * </p>
 *
 * @author 程序员clear
 * @since 2024-08-20
 */
@Getter
@Setter
@TableName("data_dictionary")
public class DataDictionary implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 数据类型分类编码
     */
    private String dataCodeCate;

    /**
     * 数据编码
     */
    private String dataCode;

    /**
     * 数据值
     */
    private String dataValue;

    /**
     * 数据字典顺序
     */
    private Integer dataSort;

    /**
     * 是否禁用
     */
    private Boolean disable;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 修改时间
     */
    private Date updateTime;


    public void initDefault() {
        if (this.getDataCodeCate() == null) {
            this.setDataCodeCate("");
        }
        if (this.getDataCode() == null) {
            this.setDataCode("");
        }
        if (this.getDataValue() == null) {
            this.setDataValue("");
        }
        if (this.getDataSort() == null) {
            this.setDataSort(0);
        }
        if (this.getDisable() == null) {
            this.setDisable(false);
        }
        if (this.getCreateTime() == null) {
            this.setCreateTime(new Date());
        }
        if (this.getUpdateTime() == null) {
            this.setUpdateTime(new Date());
        }
    }
}
